Remove Public Folder with heading \ as name
A Public Folder was accedently created as \bad folder\name and now can't do anything with it.

Get-PublicFolder -GetChildren|?{$_.Name -Like '\*'}

PowerShell line above works to find it, but trying to delete with Remove-PublicFolder or rename with Set-PublicFolder to get rid of the bad folder result in error about incorrect format of PublicFolderIdParameter. I've tried to use Exchange Online tenant as OrganizationName without effect.
If trying to use Outlook as client to do anything with it gives the behavior as not being owner of folder (grayed out delete/rename option, missing tabs in properties).

Get-PublicFolder -GetChildren | Remove-PublicFolder
Get-PublicFolder -GetChildren|?{$_.name -like '\*'} | % {Set-PublicFolder $_.identity -Name 'crap'}

Cannot process argument transformation on parameter 'Identity'. Cannot convert value "?\bad folder\name" to type "Microsoft.Exchange.Configuration.Tasks.PublicFolderIdParameter". Error: "The value provided for parameter "?\bad folder\name" isn't in the correct format. The correct format is "<OrganizationName>\\<FolderPath>"."
                                + CategoryInfo          : InvalidData: (:) [Set-PublicFolder], ParameterBindin...mationException
                                + FullyQualifiedErrorId : ParameterArgumentTransformationError,Set-PublicFolder
                                + PSComputerName        : outlook.office365.com

July 1st, 2015 9:51am

Thanks for the ideas.

I've already seen the exchange-powershell blog link.

That is about fix name and the other link is about fix corrupt alias.

It looks like a moment 22 when trying to fix identity when it complains that identity value is corrupt. If trying to change identity, there's no reference to the object on server. If I try to change name, Set-PublicFolder still complains about the identity value.

July 1st, 2015 1:42pm

OK. So try this (I was able to verify this works in Exchange 2010... have not tried 2013 yet).

I just modified the script from the first link I put in my post:

$PublicFolders = get-publicfolder -recurse | where-object {$_.Name -like "*\*"}

foreach ($Folder in $PublicFolders){
    $newName = $folder.name
    $newName = $newName.Trim()
    $newName = $newName -Replace [Regex]::Escape("\"),""

    set-publicFolder -Identity $folder.identity -Name $newName
 }

Let me know if this works.

Free Windows Admin Tool Kit Click here and download it now
July 1st, 2015 4:45pm

Thanks, but no luck. I still get error about Identity is incorrect format.
July 1st, 2015 6:26pm

OK.    Let me find an Exchange 2013 environment with Public folders and I will test it again.
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2015 9:38pm

Something else appears to be wrong.  I just did this in my test environment (older CU) and it worked fine.

What version of Exchange 2013 (CU Level?) do you have and what are the names of the Public folders you are renaming?

The folder I renamed was '\test\'.  Did you use the exact syntax I provided above?

July 1st, 2015 9:54pm

It's Exchange Online (Office365).
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2015 2:42am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics